<?php

declare(strict_types=1);

namespace App\Amqp\Producers;

use Hyperf\Amqp\Annotation\Producer;
use Hyperf\Amqp\Message\ProducerMessage;
use function Hyperf\Support\env;

#[Producer(exchange: "fund", routingKey: "fund")]
class FundProducer extends ProducerMessage
{
    public function __construct($data = [])
    {
        $this->payload = [ // 消息路由 exchange: "fund", routingKey: "fund"
            'opt' => [
                'yaoli-wealth' => [// 奖池参数,发给别的服务非数据里面参数配置这里
                    'category' => self::CATEGORY_EXPENSE_HSCOIN_EXCHANGE_BALANCE,//金豆兑换余额
                ],
                'service' => env('APP_NAME', 'yaoli'),// 生产者
            ],
            'data' => [
                'id' => $data['id'] ?? 0,
                'uid' => $data['uid'] ?? 0,
                'amount' => $data['result_amount'] ?? 0, // 不是计入奖池金额，是订单总金额，计入奖池金额奖池统一计算
                'mark' => $data['mark']??'金豆兑换余额',
                'platform'=>1,//平台来源
            ],
        ];
    }

    const CATEGORY_INCOME_ORDER_PROFIT = 1;
    const CATEGORY_INCOME_BLIND_PURCHASE_RAFFLE_PROFIT = 2;
    const CATEGORY_INCOME_REBATE_PROFIT = 3;
    const CATEGORY_INCOME_PIN_GOU_PROFIT = 4;
    const CATEGORY_INCOME_CASH_WITHDRAWAL_FEE = 5;
    const CATEGORY_INCOME_COMMISSION_WITHDRAWAL_FEE = 6;
    const CATEGORY_INCOME_EXCHANGE_NOW_MONEY = 7;
    const CATEGORY_INCOME_EXCHANGE_INTEGRAL = 8;
    const CATEGORY_EXPENSE_COMMISSION_EXPENSE = -1;
    const CATEGORY_EXPENSE_DEALER_BONUS = -2;
    const CATEGORY_EXPENSE_HSCOIN_EXCHANGE_POINTS = -3;
    const CATEGORY_EXPENSE_HSCOIN_EXCHANGE_BALANCE = -4;
    const CATEGORY_EXPENSE_CASH_BLIND_BOX_EXPENSE = -5;
    const CATEGORY_EXPENSE_PIN_GOU_BONUS_EXPENSE = -6;
    const CATEGORY_EXPENSE_REBATE_CASHBACK_EXPENSE = -7;
    const CATEGORY_EXPENSE_REBATE_AD_TASK = -8;
    const CATEGORY_EXPENSE_REBATE_INVITE_TASK = -9;
    const FUND_COUNT_CACHE_TYPE_BALANCE = 9;
    const FUND_COUNT_CACHE_TYPE_CATEGORY_INCOME = 1;
    const FUND_COUNT_CACHE_TYPE_CATEGORY_EXPENSE = -1;

    /**
     * @var string[] 奖池收入分类描述 ，可以用户订单利润
     */
    static array $categoryIncomeLabelMap = [
        self::CATEGORY_INCOME_ORDER_PROFIT => '订单利润',
        self::CATEGORY_INCOME_BLIND_PURCHASE_RAFFLE_PROFIT => '盲购抽奖利润',
        self::CATEGORY_INCOME_REBATE_PROFIT => '回米购利润',
        self::CATEGORY_INCOME_PIN_GOU_PROFIT => '拼购利润',
        self::CATEGORY_INCOME_CASH_WITHDRAWAL_FEE => '现金提现手续费',
        self::CATEGORY_INCOME_COMMISSION_WITHDRAWAL_FEE => '佣金提现手续费',
        self::CATEGORY_INCOME_EXCHANGE_NOW_MONEY => '金豆兑换现金手续费',
        self::CATEGORY_INCOME_EXCHANGE_INTEGRAL => '金豆兑换积分手续费',
    ];

    /**
     * @var string[] 奖池支出分类描述佣金支出
     */
    static $categoryExpenseLabelMap = [
        self::CATEGORY_EXPENSE_COMMISSION_EXPENSE => '佣金支出',
        self::CATEGORY_EXPENSE_DEALER_BONUS => '经销商分红',
        self::CATEGORY_EXPENSE_HSCOIN_EXCHANGE_POINTS => '睡宝金豆兑换积分',
        self::CATEGORY_EXPENSE_HSCOIN_EXCHANGE_BALANCE => '睡宝金豆兑换余额',
        self::CATEGORY_EXPENSE_CASH_BLIND_BOX_EXPENSE => '现金盲盒支出',
        self::CATEGORY_EXPENSE_PIN_GOU_BONUS_EXPENSE => '拼购奖金支出',
        self::CATEGORY_EXPENSE_REBATE_CASHBACK_EXPENSE => '回米购返现支出',
        self::CATEGORY_EXPENSE_REBATE_AD_TASK => '回米购广告任务',
        self::CATEGORY_EXPENSE_REBATE_INVITE_TASK => '回米购邀请任务',
    ];


}
